/* $Id: ProblemStatementsModel.java 129 2011-08-26 05:27:43Z altdotua@gmail.com $ */

package alt.djudge.frontend.server.models;

import java.util.List;
import java.util.Map;

import org.hibernate.criterion.Order;

import alt.djudge.frontend.server.Deployment;
import alt.djudge.frontend.server.datatypes.ProblemStatementEntry;


public class ProblemStatementsModel
{
	private static CoreInterface<ProblemStatementEntry> core = Deployment.isGAE() ?  
		new AbstractBigtableModelCore<ProblemStatementEntry>()
		{
			@Override
			protected Order getOrdering()
			{
				return Order.asc("id");
			}
			
			@Override
			protected Class<ProblemStatementEntry> getEntryClass()
			{
				return ProblemStatementEntry.class;
			}
		}
	:
		new AbstractDBModelCore<ProblemStatementEntry>()
		{
			@Override
			protected Order getOrdering()
			{
				return Order.asc("id");
			}
			
			@Override
			protected Class<ProblemStatementEntry> getEntryClass()
			{
				return ProblemStatementEntry.class;
			}
		};
	
	
	public static List<ProblemStatementEntry> getAllEntries()
	{
		return core.getAllEntries();
	}
	
	public static List<ProblemStatementEntry> getEntries(Map<String, Object> map)
	{
		return core.getEntries(map);
	}
	
	public static CoreInterface<ProblemStatementEntry> getCore()
	{
		return core.getAdapter();
	}
}
